package com.example.phonerefresh.view.util;

import android.content.Context;

/**
 * Created by l on 2016/11/30.
 */

public class DisplayUtil {


    public static int sp2dp(Context context, float pxValue) {
        float scale = context.getResources().getDisplayMetrics().scaledDensity;
        return (int) (pxValue / scale + 0.5f);
    }

    public static int converDp2pix(Context context, int dp) {
        float density = context.getResources().getDisplayMetrics().density;
        return Math.round((float) dp * density);
    }
}
